package com.sthz.facepay.mapper;

import static org.apache.ibatis.jdbc.SqlBuilder.BEGIN;
import static org.apache.ibatis.jdbc.SqlBuilder.INSERT_INTO;
import static org.apache.ibatis.jdbc.SqlBuilder.SET;
import static org.apache.ibatis.jdbc.SqlBuilder.SQL;
import static org.apache.ibatis.jdbc.SqlBuilder.UPDATE;
import static org.apache.ibatis.jdbc.SqlBuilder.VALUES;
import static org.apache.ibatis.jdbc.SqlBuilder.WHERE;

import com.sthz.facepay.model.Recharge;

public class RechargeSqlProvider {

    public String insertSelective(Recharge record) {
        BEGIN();
        INSERT_INTO("st_recharge");
        
        if (record.getId() != null) {
            VALUES("id", "#{id,jdbcType=INTEGER}");
        }

        
        if (record.getMoney() != null) {
            VALUES("money", "#{money,jdbcType=DOUBLE}");
        }
        
        if (record.getAdvertisement() != null) {
            VALUES("advertisement", "#{advertisement,jdbcType=VARCHAR}");
        }
        
        if (record.getData_time() != null) {
            VALUES("data_time", "#{data_time,jdbcType=TIMESTAMP}");
        }
        
        if (record.getOperator() != null) {
            VALUES("operator", "#{operator,jdbcType=VARCHAR}");
        }
        
        return SQL();
    }

    public String updateByPrimaryKeySelective(Recharge record) {
        BEGIN();
        UPDATE("st_recharge");
        

        if (record.getMoney() != null) {
            SET("money = #{money,jdbcType=DOUBLE}");
        }
        
        if (record.getAdvertisement() != null) {
            SET("advertisement = #{advertisement,jdbcType=VARCHAR}");
        }
        
        if (record.getData_time() != null) {
            SET("data_time = #{data_time,jdbcType=TIMESTAMP}");
        }
        
        if (record.getOperator() != null) {
            SET("operator = #{operator,jdbcType=VARCHAR}");
        }
        
        WHERE("id = #{id,jdbcType=INTEGER}");
        
        return SQL();
    }
}